<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>anim</title>
  <link rel="stylesheet" href="anim.css">
</head>
<body>
  <div class="main">
    <ul>
      <li><div class="my-anim" data-anim="my-anim-up">up</div></li>
      <li><div class="my-anim" data-anim="my-anim-upbit">upbit</div></li>
      <li><div class="my-anim" data-anim="my-anim-scale">scale</div></li>
      <li><div class="my-anim" data-anim="my-anim-scale-spring">scale1</div></li>
      <br style="clear: both;">
      <li><div class="my-anim" data-anim="my-anim-fade-in">fade-in</div></li>
      <li><div class="my-anim" data-anim="my-anim-fade-out">fade-out</div></li>
      <li><div class="my-anim" data-anim="my-anim-rotate">rotate</div></li>
      <li><div class="my-anim" data-anim="my-anim-loop">loop</div></li>
    </ul>
    <script>
      var p = document.querySelector('.main');
      p.addEventListener('click', handle);

      function handle(e) {
        var target = e.target,
            animName = target.dataset.anim;

        target.classList.remove(animName);
        setTimeout(() => {
          target.classList.add(animName);
        });
      }
    </script>
  </div>
</body>
</html>